package com.goldgov.kcloud.core.message;

import java.io.Serializable;

/**
 * kcloud消息对象
 * 
 * @author songhuiqing
 *
 */
public class KMessage implements Serializable {

	private static final long serialVersionUID = 6428782891556589121L;

	private KMessageHeaders headers;
	private String body;

	public KMessage() {
	}

	public KMessage(String body) {
		this.body = body;
	}

	public KMessage(KMessageHeaders headers, String body) {
		this.headers = headers;
		this.body = body;
	}

	public KMessage addTenancyHeader(String tenancy) {
		KMessageHeaders messageHeaders = this.getHeaders() == null ? new KMessageHeaders() : this.getHeaders();
		messageHeaders.setTenancy(tenancy);
		this.headers = messageHeaders;
		return this;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public KMessageHeaders getHeaders() {
		return headers;
	}

	public void setHeaders(KMessageHeaders headers) {
		this.headers = headers;
	}

	class KMessageHeaders implements Serializable {

		private static final long serialVersionUID = 4688176250776968658L;

		/**
		 * 租户标识
		 */
		private String tenancy;

		public String getTenancy() {
			return tenancy;
		}

		public void setTenancy(String tenancy) {
			this.tenancy = tenancy;
		}

	}

}
